<!DOCTYPE html>
<html xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<link href="resources/styles/main.css" rel="stylesheet" type="text/css" />
</h:head>

<f:event type="preRenderView" listener="#{disciplineViewBean.init}" />

<h:body>
	<p:ajaxStatus onstart="statusDialog.show();"
		onsuccess="statusDialog.hide();" />
	<p:dialog modal="true" widgetVar="statusDialog" header="#{msg.loading}"
		draggable="false" closable="false">
		<p:graphicImage value="/resources/img/ajaxloadingbar.gif" />
	</p:dialog>
	<f:view locale="#{language.localeCode}" />
	<div id="container">
		<div id="header">
			<ui:include src="/query.xhtml">
				<ui:param name="title" value="#{msg.discipline}" />
				<ui:param name="bean" value="#{disciplineViewBean}" />
			</ui:include>
		</div>
		<div id="content">
			<h:form id="disciplineform">

				<p:dataTable var="rec" rowKey="#{rec.id}" paginator="true" rows="5"
					value="#{disciplineViewBean.disciplines}"
					selection="#{disciplineViewBean.selectedDiscipline}" id="disciplineTable"
					rowsPerPageTemplate="5,10,15,25,50,100"
					emptyMessage="#{msg.norecordsfound}">

					<f:facet name="header">
            #{msg.ldiscipline} (#{disciplineViewBean.length})
        </f:facet>
        <p:ajax event="sort"
                            listener="#{disciplineViewBean.caseListSortListner}" update=":disciplineform:disciplineTable" />
					<p:column selectionMode="single" style="width:18px" />
					<p:ajax event="rowSelect"
						listener="#{disciplineViewBean.onRowSelect}"
						update=":disciplineform" />
					<p:column headerText="ID" sortBy="#{rec.id}" filterBy="#{rec.id}"
						id="id">
            #{rec.id}
        </p:column>
					<p:column headerText="Name" sortBy="#{rec.name}"
						filterBy="#{rec.name}" id="name">
            #{rec.name}
        </p:column>
					<p:column headerText="Modified" sortBy="#{rec.modified}"
						filterBy="#{rec.modified}" id="modified">
            #{rec.modified}
        </p:column>
					<p:column headerText="Created" sortBy="#{rec.created}"
						filterBy="#{rec.created}" id="created">
            #{rec.created}
        </p:column>
				</p:dataTable>
			</h:form>

		</div>
		<div id="footer">
			<ui:include src="/footer.xhtml" />
		</div>
	</div>
</h:body>
</html>